From: Jacek Konieczny Date: Wed, 14 Nov 2012 10:24:28 +0000 (+0000) Subject: hotplug/Linux: Fix locking in tools/hotplug/Linux/locking.sh X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~7658 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=e3f4dd42f626e6bf8b684eb3d157f66b60751eb4;p=xen.git hotplug/Linux: Fix locking in tools/hotplug/Linux/locking.sh The claim_lock() function would fail in the perl code with: Invalid argument at -e line 2. because the Perl snippet opens for reading the file descriptor, which was earlier opened for write (append). Signed-off-by: Jacek Konieczny Acked-by: Ian Jackson Acked-by: Ian Campbell Committed-by: Ian Campbell --- diff --git a/tools/hotplug/Linux/locking.sh b/tools/hotplug/Linux/locking.sh index e34f155438..122bcfb53b 100644 --- a/tools/hotplug/Linux/locking.sh +++ b/tools/hotplug/Linux/locking.sh @@ -44,7 +44,7 @@ claim_lock() # See below for a correctness proof. local rightfile while true; do - eval "exec $_lockfd>>$_lockfile" + eval "exec $_lockfd<>$_lockfile" flock -x $_lockfd || return $? # We can't just stat /dev/stdin or /proc/self/fd/$_lockfd or # use bash's test -ef because those all go through what is